package com.shadow.demo.data;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * entity 基类,所有业务的entity都需要继承此类,统一设置公共属性值，创建时间、修改时间
 */
@Data
public class BaseEntity implements Serializable {
    /**
     * serialVersionUID.
     **/
    private static final long serialVersionUID = -7207467261346342143L;

    /**
     * 主键序列ID.
     **/
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;
    /**
     * 创建时间.
     **/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 修改时间.
     **/
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime modifyTime;
}
